﻿using System;
using System.Linq;
using System.Collections.Generic;

using Windows.Media.Capture;
using Windows.Media.MediaProperties;
using Windows.Storage;

using XConductor.Domain.Seedwork.Capturing.Settings;
using XConductor.Infrastructure.CrossCutting.Shared.Validator.DataAnnotations;

namespace XConductor.Domain.WP8.Capturing.Settings
{
    internal class CaptureSettings : ICaptureSettings, IValidatableObject
    {
        public CaptureType CaptureType;

        public MediaCaptureInitializationSettings InitializationSettings;
        public StorageFile OutputFile;
        public MediaEncodingProfile MediaEncodingProfile;

        public IEnumerable<ValidationResult> Validate()
        {
            var errors = new List<ValidationResult>();

            if (this.OutputFile == null) errors.Add(new ValidationResult("OutputFile"));

            if (this.MediaEncodingProfile == null) errors.Add(new ValidationResult("MediaEncodingProfile"));

            return errors;
        }

        public bool IsValid()
        {
            return !this.Validate().Any();
        }
    }
}
